package tools;

public class IntVector extends Vector<Integer> {

	public IntVector(int dim) {
		super(dim);
		list = new Integer[dim];
		for(int i = 0; i < dim; i++) list[i] = new Integer(0);
		mem.addDoubleSize(dim);
	}

	@Override
	public Vector<Integer> copy() {
		Vector<Integer> ret = new IntVector(dim);
		for(int i = 0; i < dim; i++){
			ret.set(i, list[i]);
		}
		return ret;
	}

	@Override
	public boolean isBigger(Vector<Integer> other, int i) {
		return sum(i) <= other.sum(i);
	}

	@Override
	public boolean isSmaller(Vector<Integer> other, int i) {
		return sum(i) <= other.sum(i);
	}

	@Override
	public Integer sum(int i) {
		return sum(0, i);
	}

	@Override
	public Integer sum(int i, int j) {
		int ret = 0;
		
		for(int k = i; k < j; k++) ret += list[k].intValue();
		
		return new Integer(ret);
	}

	@Override
	protected Integer define0() {
		return new Integer(0);
	}


}
